<template>
  <div class="">
    <!-- <cus-search>
      <cus-search-item>
        <Form :model="form" :label-width="80">
          <cusButton
            type="primary"
            class="mb_20"
            @onClick="$refs['cusUploadModal'].show()"
            >导入</cusButton
          >
        </Form>
      </cus-search-item>
    </cus-search> -->
    <cus-card title="标准劳动营养强度表" class="">
      <cusTable
        border
        :loading="form.loading"
        :columns="columns"
        :data="data"
        :size="vuex_config.tableSize"
     
      >
      </cusTable>
    </cus-card>

    <cus-uploadModal
      ref="cusUploadModal"
      :uploadFnc="uploadStandard"
      :showUpload="true"
      :showTemp="false"
      uploadLabel="导出基础数据"
      fileName="fileName"
      :cusParams="{
        id: 'RK1603518306003',
        name: 'undefined'
      }"
      accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
      @onOk="onInit"
    >
    </cus-uploadModal>
  </div>
</template>

<script>
import {
  getStandardNutritionList,
  uploadStandard
} from "@/api/business/business";

export default {
  name: "",
  data() {
    return {
      uploadStandard: uploadStandard,
      form: {
        loading: false
      },
      columns: [
        {
          title: "营养类型",
          align: "center",
          width: "180",
          key: "nutritionType"
        },
        {
          title: "陆勤",
          slot: "huoshiDate",
          align: "center",
          children: [
            {
              width: 110,
              title: "轻度劳动",
              key: "lightWorker",
              align: "center"
              // render: (h, params) => {
              //   return h("div", [h("span", params.row.lightWorker / 100)]);
              // }
            },
            {
              width: 110,
              title: "中度劳动",
              key: "moderateWorker",
              align: "center"
              // render: (h, params) => {
              //   return h("div", [h("span", params.row.moderateWorker / 100)]);
              // }
            },
            {
              width: 110,
              title: "重度劳动",
              key: "heavyWorker",
              align: "center"
              // render: (h, params) => {
              //   return h("div", [h("span", params.row.heavyWorker / 100)]);
              // }
            },
            {
              width: 110,
              title: "极重度劳动",
              key: "limitWorker",
              align: "center"
              // render: (h, params) => {
              //   return h("div", [h("span", params.row.limitWorker / 100)]);
              // }
            }
          ]
        },
        {
          title: "海勤",
          align: "center",
          children: [
            {
              width: 150,
              title: "水面舰艇人员",
              key: "surfaceShipPersonnel",
              align: "center"
              // render: (h, params) => {
              //   return h("div", [
              //     h("span", params.row.surfaceShipPersonnel / 100)
              //   ]);
              // }
            },
            {
              width: 150,
              title: "潜艇人员",
              key: "submarinePersonnel",
              align: "center"
              // render: (h, params) => {
              //   return h("div", [
              //     h("span", params.row.submarinePersonnel / 100)
              //   ]);
              // }
            },
            {
              width: 150,
              title: "核潜艇人员",
              key: "nuclearSubmarinePersonnel",
              align: "center"
              // render: (h, params) => {
              //   return h("div", [
              //     h("span", params.row.nuclearSubmarinePersonnel / 100)
              //   ]);
              // }
            }
          ]
        },
        {
          title: "空勤",
          align: "center",
          children: [
            {
              minWidth: 120,
              title: "飞行人员",
              key: "pilots",
              align: "center"
              // render: (h, params) => {
              //   return h("div", [h("span", params.row.pilots / 100)]);
              // },
            }
          ]
        },
        {
          title: "耐受上限",
          width: 150,
          key: "max",
          align: "center"
        }
      ],
      data: []
    };
  },
  computed: {},
  mounted() {
    this.onInit();
  },
  methods: {
    onInit() {
      this.getStandardNutritionListApi();
    },
    // 获取伙食登记薄列表
    getStandardNutritionListApi() {
      this.form.loading = true;
      return new Promise(resolve => {
        getStandardNutritionList({
          starttime: this.form.startTime,
          endtime: this.form.endTime
        }).then(res => {
          if (res.retCode === 2000) {
            console.log(res,2222);
            this.form.loading = false;
            this.data = res.data;
            resolve();
          } else this.form.loading = false;
        });
      });
    }
  }
};
</script>

<style scoped lang="scss"></style>
